//
//  SXStatusRetweetedView.swift
//  sina
//
//  Created by shengxinwei on 16/5/25.
//  Copyright © 2016年 shengxinwei. All rights reserved.
//

import UIKit
import SnapKit

class SXStatusRetweetedView: UIView {
    
    var statusViewModel: SXStatusViewModel? {
        didSet {
            retweetedLabel.text = statusViewModel?.status?.retweeted_status?.text
            retweetedPic.pictures = statusViewModel?.status?.retweeted_status?.pic_urls
        }
    }

    
    override init(frame: CGRect) {
        super.init(frame: frame)
        self.backgroundColor = UIColor(white: 0.95, alpha: 1)
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    
    private func setupUI() {
        addSubview(retweetedLabel)
        addSubview(retweetedPic)
        
        retweetedLabel.snp_makeConstraints { (make) in
            make.top.left.equalTo(self).offset(cellMargin)
            make.right.equalTo(self).offset(-cellMargin)
        }
        
        retweetedPic.snp_makeConstraints { (make) in
            make.top.equalTo(retweetedLabel.snp_bottom).offset(cellMargin)
            make.left.equalTo(retweetedLabel)
            
        }
        
        self.snp_makeConstraints { (make) in
            //make.top.left.right.equalTo(self)
            make.bottom.equalTo(retweetedPic.snp_bottom).offset(cellMargin)
        }
    }
    
    
    lazy var retweetedLabel: UILabel = {
       let lab = UILabel()
        lab.font = UIFont.systemFontOfSize(14.0)
        lab.text = "沙发客看搜房卡是否久爱时空发酵"
        lab.numberOfLines = 0
        lab.textAlignment = .Left
        return lab
    }()
    
    
    lazy var retweetedPic: SXStatusPictureView = SXStatusPictureView()
    
    

}
